<?php
	$css_list[0]['url'] = './tpl/css/article.css';
?>
<!--{template inc/header_n}-->

<div class="main_warp">
    <div class="inventory">
        <!--{template inc/list/list_menu}-->

        <div class="i_righter">
			<form id="myform" action="/list.php?action=plan" method="post">
            <div class="cart" style="width:100%;">
                <table class="i_tb">
                    <tr>
                        <td width="50">名称</td>
                        <td><input type="text" name="tip" value="{$_FANWE['user']['user_name']}的火锅"/></td>
                    </tr>
                    <tr>
                        <td>时间</td>
                        <td><input id="dateline" type="text" name="dateline" readonly /><img style="vertical-align:middle;" onclick="WdatePicker({el:'dateline'})" src="/public/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle"></td>
                    </tr>
                    <tr>
                        <td>AM/PM</td>
                        <td>
                            <input type="radio" name="ampm" value="0" checked/>上午
                            <input type="radio" name="ampm" value="1"/>下午
                        </td>
                    </tr>
                </table>
                <table class="i_tb">
                    <caption style="text-align:left;color:red;">请勾选没有完成的项目:</caption>
                    <tr>
                        <td class="j_tt" style="padding:10px 5px;"><label>
                            <input type="checkbox" onclick="selall(this.checked)"/>全选</label></td>
                    </tr>
                <!--{loop $config $k $v}-->
                    <tr>
                        <td class="j_tt" style="padding:10px 5px;"><label>
                            <input type="checkbox" class="cb"{if $v['isdir']} onclick="sel({$k},this.checked)"{else} name="ids[]" value="-1|{$k}"{/if}/>
                            {$v['name']}</label></td>
                    </tr>
                    <!--{if $v['isdir']}-->
                    <tr><td>
                        <table class="i_tb" style="margin:0 10px;width:90%;">
                            <!--{loop $v['children'] $k1 $v1}-->
                            <tr>
                                <td style="border:1px solid #CCC;">
                                    <input type="checkbox" name="ids[]" class="cb" value="{$k}|{$k1}" group="g-{$k}"/>
                                    {$v1['name']}
                                </td>
                            </tr>
                            <!--{/loop}-->
                        </table>
                    </td></tr>
                    <!--{/if}-->
                <!--{/loop}-->
                    <tr>
                        <td><input type="submit" style="padding:2px 6px;" class="green_button" name="doadd" value="提交"/></td>
                    </tr>
                </table>
            </div>
            <br/>
			</form>
        </div>
        <br class="g_clear" />
</div>



<!--{template inc/footer}-->
<script language="javascript" type="text/javascript" src="/public/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" charset="utf-8" src="/public/js/jquery.form.min.js"></script>
<script type="text/javascript">
function sel(pid, b) {
    $('input[type=checkbox][group=g-'+pid+']').attr('checked', b);
}

$('#myform').ajaxForm(function(s) {
	if(s == 'tip empty') {
	    alert('进度表名称不能为空！');
	} else if(s == 'dateline empty') {
	    alert('时间不能为空！');
	} else if(s == 'ids empty') {
	    alert('请至少选择一个未完成项！');
	} else if(s == 'ok') {
	    location.href = '/list.php?action=plan';
	} else {
	    alert('未知错误！');
	}
});

function selall(b) {
    $('.cb').attr('checked', b);
}
</script>